export const OPERATE_TAB = [
  {
    value: 'basicInformation',
    label: '基本信息'
  },
  {
    value: 'associatedSalesOrder',
    label: '关联销售单'
  }
]

// 方案信息
export const base = info => {
  return [
    { name: '方案ID', label: 'id' },
    { name: '方案名称', label: 'name' },
    { name: '有效期', label: 'timeTypeDes' },
    { name: '方案类型', label: 'typeDes' },
    // 如果 方案类型为1:根据销售单绑定卡券数量 则不显示 支付类型
    { hide: info.form.type.toString() === '1', name: '支付类型', label: 'payTypeDes' },
    { name: '触发场景', label: 'sceneDes' },
    { name: '使用产品', label: 'productTypeDes' },
    { name: '领取方式', label: 'receiveTypeDes' },
    { name: '修改日期', label: 'updateTime' }
  ]
}

// 赠送卡券
export const givingCouponColumns = ctx => {
  return [
    {
      prop: 'orderNo',
      label: '销售单号'
    },

    {
      prop: 'limitPersonNum',
      label: '每人限制最高领取数量'
    },
    {
      label: '每次可领取数量',
      render: (h, row) => {
        return (
          ctx.form.type === '3'
            ? <span>根据会员购票数量</span> : <span>{row.receiveNum}</span>
        )
      }
    },
    {
      prop: 'propsTypeDes',
      label: '卡券类型'
    },
    {
      prop: 'expiredName',
      label: '有效期'
    },
    {
      prop: 'totalSendNum',
      label: '累积赠送数量'
    },
    {
      prop: 'totalReceiveNum',
      label: '累积领取数量'
    },
    {
      prop: 'totalUseNum',
      label: '累积使用数量'
    }
  ]
}

// 关联销售单
export const columns = context => {
  return [
    {
      prop: 'orderNo',
      label: '销售单号'
    },
    {
      prop: 'orderName',
      label: '销售单名称'
    },
    {
      prop: 'customerName',
      label: '关联客户'
    },
    {
      prop: 'productName',
      label: '销售产品'
    },
    {
      prop: 'productCode',
      label: '产品编码'
    },

    {
      prop: 'salePrice',
      label: '销售单价'
    },
    {
      prop: 'operatorId',
      label: '归属业务员'
    },
    {
      prop: 'number',
      label: '销售数量'
    },
    {
      prop: 'saleTotalPrice',
      label: '销售单总额'
    },
    {
      prop: 'totalSendNum',
      label: '累积送券数量'
    },
    {
      prop: 'totalUseNum',
      label: '累积使用数量'
    },
    {
      prop: 'updateTime',
      label: '关联时间'
    },
    {
      button: true,
      label: '操作',
      fixed: 'right',
      width: 120,
      render: (h, row) => {
        return <el-button
          disabled={row.isSendProgram.toString() === '0'}
          type="text"
          onClick={() => {
            context.isBind(row)
          }}
        >
          {row.isSendProgram === '1' ? '解绑' : '已解绑'}
        </el-button>
      }
    }

  ]
}
